﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.CMS263.PO;

namespace Com.CMS263.DAO
{
    public class DiscussDAO : BaseService
    {
        public IList<Discuss> GetListByPaging(int page, int pagesize)
        {
            string hql = " from Discuss where 1=1 and (BeginDate <= getdate() and EndDate > getdate()) order by BeginDate desc";
            return FindList<Discuss>(hql, null, ((page - 1) * pagesize), pagesize);
        }
        public IList<Discuss> GetListByOld(int page, int pagesize)
        {
            string hql = " from Discuss where 1=1 and  EndDate < getdate() order by BeginDate desc";
            return FindList<Discuss>(hql, null, ((page - 1) * pagesize), pagesize);
        }
        public int GetListByPaging()
        {
            string hql = "select count(*) from Discuss where 1=1 and (BeginDate <= getdate() and EndDate > getdate()) ";
            return Convert.ToInt32(GetValue(hql));
        }
        public int GetListByOld()
        {
            string hql = "select count(*)  from Discuss where 1=1 and  EndDate < getdate() ";
            return Convert.ToInt32(GetValue(hql));
        }
    }
}
